package com.iweb.service;

import com.iweb.mapper.UserMapper;
import com.iweb.pojo.User;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImp implements UserService {
    @Autowired
    UserMapper userMapper;

    @Override
    public List login(User user) {
        return userMapper.login(user);
    }

    @Override
    public boolean addUser(User user) {
        return userMapper.insert(user) >0;
    }


    @Override
    public User selectByPhone(String phone){
        return userMapper.selectByPhone(phone);
    }

    @Override
    public boolean updatePersonalInfo(User user) {
        return userMapper.updatePersonalInfo(user)>0;
    }

    @Override
    public List selectUserInfo(int id) {
        return userMapper.selectUserInfo(id);
    }
    @Override
    public User selectPhone(String phone){
        return userMapper.selectPhone(phone);
    }

    @Override
    public boolean updatePassword(User user) {
        return userMapper.updatePassword(user);
    }

    @Override
    public String queryPassword(User user) {
        return userMapper.queryPassword(user);
    }

    @Override
    public List selectList() {
        return userMapper.selectList(3);
    }


    @Override
    public boolean addAdmin(User user) {
        return userMapper.addAdmin(user);
    }

    @Override
    public List queryAdmin(int powerID) {
        return userMapper.queryAdmin(powerID);
    }

    @Override
    public boolean delete(int userID) {
        return userMapper.deleteAdmin(userID) >0;
    }

    @Override
    public List selectListByID(int userID) {
        return userMapper.selectListByID(userID);
    }

    @Override
    public void recharge(User user) {
        userMapper.recharge(user);
    }

    @Override
    public void updateCategoryLevel(User user) {
        userMapper.updateCategoryLevel(user);
    }

    @Override
    public int selectCidByUserID(int userID) {
        return userMapper.selectCidByUserID(userID);
    }

    @Override
    public List queryUserInfo(int userID) {
        return userMapper.queryUserInfo(userID);
    }


}
